Skip to content

feat(generic-includer): add linkIndexAutotitle option for directory titles from index.md#1898

Merged
martyanovandrey merged 3 commits intomasterfrom
feat/generic-includer-link-index-autotitle
May 5, 2026
Merged

feat(generic-includer): add linkIndexAutotitle option for directory titles from index.md#1898
martyanovandrey merged 3 commits intomasterfrom
feat/generic-includer-link-index-autotitle

Conversation

@martyanovandrey
Copy link
Copy Markdown
Contributor

@martyanovandrey martyanovandrey commented Apr 29, 2026

Summary

  • Add linkIndexAutotitle option (default false) to the generic includer.
  • When linkIndexAutotitle: true is set together with linkIndex (and autotitle is not disabled), the directory entry's title is derived from the H1 heading of its nested index.md via the existing autotitle pipeline. Otherwise the folder name is used (backward-compatible default).

Closes #1872

@martyanovandrey martyanovandrey requested a review from a team as a code owner April 29, 2026 08:23
@martyanovandrey martyanovandrey requested review from stenin-nikita and removed request for a team April 29, 2026 08:23
@martyanovandrey martyanovandrey changed the title feat(generic-includer): use index.md heading for directory name with linkIndex+autotitle feat(generic-includer): add linkIndexAutotitle option for directory titles from index.md Apr 29, 2026
@martyanovandrey martyanovandrey requested a review from a team May 4, 2026 09:12
@martyanovandrey martyanovandrey force-pushed the feat/generic-includer-link-index-autotitle branch from 12d096f to 1f85900 Compare May 4, 2026 11:46

if (indexHref) {
const useIndexHeading =
options.linkIndexAutotitle === true && options.autotitle !== false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not options.linkIndexAutotitle && !options.autotitle?

Copy link
Copy Markdown
Contributor Author

@martyanovandrey martyanovandrey May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestion inverts the semantics. options.autotitle !== false is true when autotitle is enabled (true or undefined), while !options.autotitle is true when it's disabled (false or undefined). We need the former — deriving a title from index.md's H1 only makes sense when autotitle isn't disabled. The should keep folder name when linkIndexAutotitle is set but autotitle is disabled test covers this.

Comment thread src/extensions/generic-includer/index.ts
…linkIndex+autotitle

When linkIndex is enabled together with autotitle (the default), let the
existing autotitle pipeline derive a directory entry's title from the heading
of its nested index.md, instead of always using the directory name.

Closes #1872
…dexAutotitle

Instead of always deriving the directory entry's title from the index.md
heading when linkIndex+autotitle are both enabled, gate the new behavior
behind an explicit linkIndexAutotitle option (default false).

This preserves backward compatibility with existing linkIndex consumers
that rely on folder names for directory titles.
@martyanovandrey martyanovandrey force-pushed the feat/generic-includer-link-index-autotitle branch from 1f85900 to 24f5caa Compare May 5, 2026 14:15
@martyanovandrey martyanovandrey force-pushed the feat/generic-includer-link-index-autotitle branch from 24f5caa to 9e6b194 Compare May 5, 2026 14:16
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@martyanovandrey martyanovandrey merged commit 52c9672 into master May 5, 2026
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Отображать заголовок родительского раздела из index.md в GenericIncluder

2 participants